// *********************************************************
//      Copyright (c) Kosta Gaitanis
//      All rights reserved
//
//      k.gaitanis@gmail.com
//
// *********************************************************

#ifndef MATERIALWIDGET_H
#define MATERIALWIDGET_H

#include "Material.h"
#include "GUI/ColorPickerWidget.h"

#include "GUI/CollapsibleWidget.h"

class MaterialWidget : public CollapsibleWidget
{
    Q_OBJECT
public:
    MaterialWidget(Material* material = 0, QWidget *parent = 0);
    ~MaterialWidget();

    void setMaterial(Material* material);
    const Material* getMaterial() const;

    void setAmbient(const QColor& color);
    void setDiffuse(const QColor& color);
    void setSpecular(const QColor& color);
    void setEmission(const QColor& color);
    void setShininess(double shininess);

signals:
    void changed();

private slots:
    void onAmbientChanged(const QColor& color);
    void onDiffuseChanged(const QColor& color);
    void onSpecularChanged(const QColor& color);
    void onEmissionChanged(const QColor& color);
    void onShininessChanged(double shininess);
    void onTransparencyChanged(double transparency);

private:
    Q_DISABLE_COPY(MaterialWidget)

    void hideAll();
    void showAll();

    Material *m_material;
    ColorPickerWidget *m_ambient, *m_diffuse, *m_specular, *m_emission;
    QDoubleSpinBox *m_shininess, *m_transparency;

};

#endif // MATERIALWIDGET_H
